<template>
  <div class="divisional">

    <div class="search_box">
      <el-row :gutter="20">
        <el-col :span="6" v-for="(item,index) in list_1" :key="index">
          <span class="inpText">{{item.text}}</span>
          <el-input v-model.trim="item.input_val" autocomplete="off" size="small" class="searchInp" placeholder="请输入内容"></el-input>
        </el-col>
      </el-row>

      <!-- 按钮-->
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <el-button size="small" type="primary" @click="search">查询</el-button>
      <el-button size="small" type="primary" @click="reset">重置</el-button>
    </div>

    <!-- <div class="search_box">
      <el-row :gutter="20">
        <el-col :span="6">
          <span class="inpText">机构名称:</span>
          <el-input v-model="searchBox.name" autocomplete="off" size="small" class="searchInp"></el-input>
        </el-col>
        <el-col :span="6">
          <span class="inpText">机构编号:</span>
          <el-input v-model="searchBox.code" autocomplete="off" size="small" class="searchInp"></el-input>
        </el-col>
        <el-col :span="6">
          <el-button type="primary" size="small" @click="goSearch" v-if="$requestBtnApi.organ.queryBtn">查询</el-button>
          <el-button type="primary" size="small" @click="resetData">重置</el-button>
        </el-col>
      </el-row>
    </div> -->


    <!--
      <el-col :span="24">
        <div class="inputBox">
          <div class="v_box" v-for="(item,index) in list_1" :key="index">
            <label for>{{item.text}}</label>
            <el-input v-model="item.input_val" size="small" placeholder="请输入内容"></el-input>
          </div>
          <div class="v_box">
            <el-button size="small" type="primary" @click="checkInfo">查询</el-button>
            <el-button size="small" type="primary" @click="reset">重置</el-button>
          </div>
        </div>
      </el-col> -->

    <el-row :gutter="20">
      <el-col :span="24">
        <el-table :data="tableData" :header-cell-style="{background:'LightYellow	',color:'black'}" max-height="460" style="width: 100%">
          <el-table-column prop="serialNumber" label="案件号" width></el-table-column>
          <el-table-column prop="bank" label="所属银行"></el-table-column>
          <el-table-column prop="peopleId" label="身份证号" :formatter="hidInfo"></el-table-column>
          <el-table-column prop="contractNum" label="贷款合同号"></el-table-column>
          <el-table-column prop="customerId" label="客户号"></el-table-column>
          <el-table-column prop="phoneNum" label="手机号" :formatter="hidInfo"></el-table-column>
          <el-table-column prop="sendTime" label="发送时间"></el-table-column>
        </el-table>
      </el-col>
    </el-row>
    <div class="pageBox">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
        :page-sizes="[5, 10, 15,20]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
    </div>
  </div>
</template>
<script>
  import {
    Message
  } from "element-ui";
  import {
    cmcUrl
  } from "../../../static/baseUrl";
  export default {
    data() {
      return {
        dateVlaue: "",
        isInfodetail: false,
        currentPage: 1,
        total: 0,
        pageSize: 5,
        list_1: [{
            text: "所属银行  ",
            name: "bank",
            input_val: "",
          },
          {
            text: "案 件 号",
            name: "serialNumber",
            input_val: "",
          },

          {
            text: "客 户 号   ",
            name: "customerId",
            input_val: "",
          },
          {
            text: "贷款合同号",
            name: "contractNum",
            input_val: "",
          },
          {
            text: "身份证号",
            name: "peopleId",
            input_val: "",
          },
          {
            text: "手 机 号",
            name: "phoneNum",
            input_val: "",
          },
        ],
        options: [{
            value: "选项1",
            label: "黄金糕",
          },
          {
            value: "选项2",
            label: "双皮奶",
          },
          {
            value: "选项3",
            label: "蚵仔煎",
          },
          {
            value: "选项4",
            label: "龙须面",
          },
          {
            value: "选项5",
            label: "北京烤鸭",
          },
        ],
        tableData: [],
        //   逾期选择
        isFirstIssue: "",
        yuqiOptions: [{
            label: "是",
            value: 1,
            index: 0,
          },
          {
            label: "否",
            value: 0,
            index: 1,
          },
        ],
        //   催收
        cuishouNum: "",
        //   催收方式
        outbound: "",
        outboundOptions: [
          //    1短信 2智能 3人工
          {
            label: "短信",
            value: "1",
          },
          {
            label: "智能",
            value: "2",
          },
          {
            label: "人工",
            value: "3",
          },
        ],
        //   风险等级
        risklevel: "",
        risklevelOptions: [{
            label: "高风险",
            value: "高风险",
            index: 1,
          },
          {
            label: "中风险",
            value: "中风险",
            index: 2,
          },
          {
            label: "低风险",
            value: "低风险",
            index: 3,
          },
        ],
        //   逾期等级
        overdueLevelF: "",
        overdue_levelS: "",
        overdueLevelOptions: [{
            label: "M1",
            value: "M1",
            index: 1,
          },
          {
            label: "M2",
            value: "M2",
            index: 2,
          },
          {
            label: "M3",
            value: "M3",
            index: 3,
          },
        ],
        //   详情
        detailInfo: [],
      };
    },
    created() {
      this.checkInfo();
    },
    methods: {
      search(){
        this.currentPage = 1;
        this.checkInfo();
      },
      handleCurrentChange(data) {
        this.currentPage = data;
        this.checkInfo();
      },
      handleSizeChange(data) {
        console.log(data, "handleSizeChange");
        this.pageSize = data;
        this.checkInfo();
      },
      handleInfoDetail(val) {
        switch (val) {
          case "phoneNum":
            return "手机号";
          case "riskLecvel":
            return "风险等级";
            s
          case "erialNumber":
            return "案件号";
          case "bank":
            return "所属银行";
          case "customerId":
            return "客户号";
          case "contractNum":
            return "贷款合同号";
          case "peopleId":
            return "身份证号";
          case "isFirstIssue":
            return "逾期次数";
          case "collectionTimes":
            return "催收次数";
          case "riskLevel":
            return "风险等级";
          case "overdueLevelF":
            return "逾期等级";
          case "outbound":
            return "下方方向";
          case "id":
            return "ID";
          case "receiptNum":
            return "贷款借据号";
          case "name":
            return "姓名";
          case "age":
            return "年龄";
          case "sex":
            return "性别";
          case "education":
            return "学历";
          case "maritalStatus":
            return "婚姻状况";
          case "overdueAmount":
            return "逾期金额";
          case "overdueDay":
            return "逾期天数";
          case "overduePrincipal":
            return "逾期本金";
          case "productName":
            return "产品名称";
          case "applicationTime":
            return "申请时间";
          case "lateCharge":
            return "逾期罚息";
          case "customerLabel":
            return "客群细分标签";
          case "repaymentNum":
            return "还款账号";
          case "collectionPriority":
            return "催收优先等级";
          case "interestRefund":
            return "退罚息";
          case "newAndOldLoansn":
            return "新老网贷";
          case "score":
            return "评分";
          case "state":
            return "状态";
          case "dataTime":
            return "数据时间";
          case "division":
            return "division";
          case "repaymentAmount":
            return "还款金额";
          case "repaymentDate":
            return "还款时间";
          case "scriptTemplate":
            return "话术模板";
          default:
            return val;
        }
      },
      handleClick(data) {
        console.log(data, "sss");
        this.detailInfo.splice(this.detailInfo.length);
        Object.keys(data).forEach((item) => {
          let obj = {
            label: this.handleInfoDetail(item),
            value: data[item],
          };
          this.detailInfo.push(obj);
        });
        console.log(this.detailInfo, "this.detailInfo");
        this.isInfodetail = true;
      },
      reset() {
        console.log(this.dateVlaue);
        this.list_1.forEach((item) => {
          item.input_val = "";
        });
        this.dateVlaue = "";
      },
      checkInfo() {

        let options = {
          page: this.currentPage,
          pageSize: this.pageSize,
        };
        //设置动态字段
        Object.keys(this.list_1).forEach((item) => {
          let dataMap = this.list_1[item];
          console.info("dataMap=", dataMap);
          this.$set(options, dataMap.name, dataMap.input_val);
        });

        this.$axios({
            method: "post",
            url: `/CMC/recovery/message/list`,
            data: options,
          })
          .then((res) => {
            console.log(res, "查询数据");
            if (res.code == 200) {
              this.tableData = res.data.list;
              this.total = Number(res.data.total);
            } else {
              Message.warning(res.message);
            }
          })
          .catch((err) => {});
      },
    },
  };
</script>
<style lang="scss" scoped>
  .divisional {
    /deep/ .el-row:nth-child(1) {
      width: 100%;
      height: 36px;
      // background: pink;
      padding: 0;
      margin: 0;

      .el-col {
        padding: 0;
        height: inherit;
        /* border: 1px solid slategrey; */
        box-sizing: border-box;
        overflow: hidden;

        div:nth-child(1) {
          width: 100%;
          height: inherit;
          //   background: yellowgreen;
          display: flex;
          flex-wrap: wrap;
          // justify-content: flex-start;
          justify-content: space-around;
          box-sizing: border-box;
          padding-left: 30px;
          padding-top: 40px;
          overflow-y: auto;

          .v_box {
            width: 20%;
            height: 8vh;
            margin-left: 15px;
            margin-right: 40px;
            // margin-bottom: 10px;
            // background: chocolate;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            padding: 0;
            border: none;

            div {
              padding: 0;
            }

            &:nth-child(7) {

              .el-date-editor--daterange.el-input,
              .el-date-editor--daterange.el-input__inner,
              .el-date-editor--timerange.el-input,
              .el-date-editor--timerange.el-input__inner {
                width: 100%;
              }
            }

            &:last-child {
              display: flex;
              flex-direction: row;
              justify-content: center;
              align-items: center;

              .el-button {
                width: 70px;
                height: 30px;

                &:first-child {
                  margin-right: 10px;
                }
              }
            }
          }
        }
      }
    }

    /deep/ .el-row:nth-child(2) {
      width: 100%;
      height: 70vh;
      // background: pink;
      padding: 0;
      margin: 0;
      margin-top: 10px;

      table {
        tbody {
          tr {
            td {
              .cell {
                box-sizing: border-box;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                word-break: normal !important;
                line-height: inherit;
                //   padding-right: 10px;
              }
            }
          }
        }
      }
    }

    .pageBox {
      display: flex;
      width: 100%;
      justify-content: center;
    }

    /deep/ .el-dialog {
      .mainInfoBox {
        width: 100%;
        height: 60vh;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        overflow-y: auto;

        .infoBox {
          display: flex;
          flex-direction: row;
          justify-content: center;
          align-items: center;
          height: 40px;
          width: 30%;

          label {
            width: 100px;
          }

          .el-input {
            flex: 1 1 auto;
          }
        }
      }
    }
  }

  @import "../../assets/css/base.css";

  .search_box {
    background: #fff;
    border-radius: 10px;
    padding: 40px 40px 60px 40px;
    margin: 0 0 20px 0;
  }

  .box_center {
    text-align: left;
  }

  .searchBtn {
    margin-left: 80px;
  }
</style>
